package de.Torganzier.presentation.GUI;

import java.awt.Dimension;
import java.awt.Label;
import java.awt.MenuBar;
import java.awt.TextField;
import java.awt.event.ActionListener;
import java.security.acl.Owner;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SpringLayout;

public class AddEmployeeDialog extends JDialog {
	
	private JTextField firstName;
	private JTextField lastName;
	private JButton OKButton;
	private JButton AbbortButton;
	private ActionListener actionListner;
	
	
	
	public JButton getOKButton() {
		return OKButton;
	}

	public JButton getAbbortButton() {
		return AbbortButton;
	}

	public void  initDialoag(){
		this.firstName = new JTextField();
		this.lastName = new JTextField();
		this.OKButton = new JButton("OK");
		this.AbbortButton = new JButton("Abbrechen");
		
		this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.LINE_AXIS));
		
		this.OKButton.addActionListener(this.actionListner);
		this.AbbortButton.addActionListener(this.actionListner);
		
		Box mainBox = Box.createVerticalBox();
		
		Box inputBox = Box.createVerticalBox();
		inputBox.add(new Label("Vorname"));
		inputBox.add(this.firstName);
		inputBox.add(Box.createHorizontalStrut(5));
		inputBox.add(new Label("Nachname"));
		inputBox.add(this.lastName);
		mainBox.add(inputBox);
		
		Box buttonBox = Box.createHorizontalBox();
		buttonBox.add(OKButton);
		buttonBox.add(Box.createVerticalStrut(20));
		buttonBox.add(AbbortButton);
		
		mainBox.add(buttonBox);
	
		
		this.add(mainBox);
	
	}
	
	public String getFirstName(){
		return firstName.getText();
	}
	
	public String getLastName(){
		return lastName.getText();
	}
	
	public AddEmployeeDialog(JFrame owner,ActionListener al){
		super(owner);
		this.actionListner = al;
		initDialoag();
		this.setResizable(false);
		this.setPreferredSize(new Dimension(300, 150));
		this.pack();
	}
	
}
